package com.mes.cloud.controller;

import com.mes.cloud.dto.BmeBcCodeDTO;
import com.mes.cloud.dto.BmeBcDigitalDTO;
import com.mes.cloud.service.BmeBcCodeService;
import com.mes.cloud.utils.JSONResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;

/**
* 编码配置
* @author wxm
* @Time 2020-4-13
*/
@RestController
@RequestMapping("/bmeBcCode")
public class BmeBcCodeController {
    private static final Logger LOGGER = LoggerFactory.getLogger(BmeBcCodeController.class);

    @Autowired
    private BmeBcCodeService bmeBcCodeService;

    @RequestMapping(value = "/findList", method = RequestMethod.POST)
    public JSONResult getList(@RequestBody Map<Object, Object> map) {
        JSONResult result = JSONResult.success(bmeBcCodeService.findList(map));
        return result;
    }
    
    @RequestMapping(value = "/findPageList", method = RequestMethod.POST)
    public JSONResult getPageList(@RequestBody Map<Object, Object> map) {
        JSONResult result = JSONResult.success(bmeBcCodeService.findPageList(map));
        return result;
    }
    

    @RequestMapping(value = "/insert", method = RequestMethod.POST)
    public JSONResult insert(@RequestBody @NotNull BmeBcCodeDTO bmeBcCodeDTO) {
        JSONResult result = JSONResult.success(bmeBcCodeService.insert(bmeBcCodeDTO));
        return result;
    }

    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public JSONResult update(@RequestBody @NotNull BmeBcCodeDTO bmeBcCodeDTO) {
        JSONResult result = JSONResult.success(bmeBcCodeService.update(bmeBcCodeDTO));
        return result;
    }

    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public JSONResult delete(@RequestBody BmeBcCodeDTO bmeBcCodeDTO) {
        JSONResult result = JSONResult.success(bmeBcCodeService.delete(bmeBcCodeDTO.getId()));
        return result;
    }

    @RequestMapping(value = "/get", method = RequestMethod.POST)
    public JSONResult get(@RequestBody BmeBcCodeDTO bmeBcCodeDTO) {
        JSONResult result = JSONResult.success(bmeBcCodeService.get(bmeBcCodeDTO.getId()));
        return result;
    }
}
